In a conventional image forming apparatus, a recording material such as a sheet is fed from a paper feeding cassette to an image forming portion by a feed roller and conveyed. The recording material may be conveyed while being skewed with respect to a conveying direction of the recording material due to various effects, such as a difference of the outer diameter of the conveying roller, a difference of the sheet conveyance speed due to wear of the conveying roller, and a frictional resistance between the recording material and a conveyance guiding member that guides the recording material. If a toner image on a photosensitive drum is transferred to the recording material while the recording material is conveyed in a skewed state, the image is printed in a skewed state with respect to the recording material. Therefore, there is an image forming apparatus in which a shutter member is provided to a pair of registration rollers or a pair of conveying rollers to suppress the skew of the recording material, the leading edge of the recording material is aligned by causing the leading edge of the recording material to come into contact with the shutter member, and then the recording material is conveyed to the image forming portion, so that the skew is suppressed. However, although the configuration for suppressing the skew by causing the leading edge of the recording material to come into contact with the shutter member is effective in a direction parallel to the conveying direction of the recording material, a position shift cannot be suppressed in a direction perpendicular to the conveying direction of the recording material. In a configuration for performing duplex printing, a recording material that has passed through a fixing unit to print a first surface contracts by heat and pressure from the fixing unit, so that the size of the recording material of a second surface becomes smaller than the size of the recording material of the first surface. Thus, the end position of the recording material may vary.
Therefore, there is an image forming apparatus which has a configuration for detecting a recording material end position in a direction parallel to the conveying direction of the recording material in order to suppress the position shift in the direction perpendicular to the conveying direction of the recording material. As a configuration for detecting a recording material end position, PTL 1 discloses a method in which a photo interrupter is moved across the recording material in a direction perpendicular to the conveying direction of the recording material and the recording material end position is detected by a distance from a datum point to a position from which the recording material blocks light. Also, PTL 1 discloses a method for correcting a position shift between the recording material and an image by relatively matching the position of the recording material with an image forming position.